Produced by Araxis Merge on 2023-03-13 03:00:44 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Porto v4.0.4/Porto Theme/app/code/Mageplaza/LayeredNavigation/Model/Search | FilterGroupBuilder.php | 2022-04-22 07:34:10 +0000 |
| 2 | Porto v4.0.5/Porto Theme/app/code/Mageplaza/LayeredNavigation/Model/Search | FilterGroupBuilder.php | 2022-04-22 07:34:10 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 1 | 274 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | <?php | 1 | <?php | |||
| 2 | /** | 2 | /** | |||
| 3 | * Mageplaza | 3 | * Mageplaza | |||
| 4 | * | 4 | * | |||
| 5 | * NOTICE OF LICENSE | 5 | * NOTICE OF LICENSE | |||
| 6 | * | 6 | * | |||
| 7 | * This source file is subject to the Mageplaza.com license that is | 7 | * This source file is subject to the Mageplaza.com license that is | |||
| 8 | * available through the world-wide-web at this URL: | 8 | * available through the world-wide-web at this URL: | |||
| 9 | * https://www.mageplaza.com/LICENSE.txt | 9 | * https://www.mageplaza.com/LICENSE.txt | |||
| 10 | * | 10 | * | |||
| 11 | * DISCLAIMER | 11 | * DISCLAIMER | |||
| 12 | * | 12 | * | |||
| 13 | * Do not edit or add to this file if you wish to upgrade this extension to newer | 13 | * Do not edit or add to this file if you wish to upgrade this extension to newer | |||
| 14 | * version in the future. | 14 | * version in the future. | |||
| 15 | * | 15 | * | |||
| 16 | * @category Mageplaza | 16 | * @category Mageplaza | |||
| 17 | * @package Mageplaza_LayeredNavigation | 17 | * @package Mageplaza_LayeredNavigation | |||
| 18 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | 18 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | |||
| 19 | * @license https://www.mageplaza.com/LICENSE.txt | 19 | * @license https://www.mageplaza.com/LICENSE.txt | |||
| 20 | */ | 20 | */ | |||
| 21 | 21 | |||||
| 22 | namespace Mageplaza\LayeredNavigation\Model\Search; | 22 | namespace Mageplaza\LayeredNavigation\Model\Search; | |||
| 23 | 23 | |||||
| 24 | use Magento\Framework\Api\FilterBuilder; | 24 | use Magento\Framework\Api\FilterBuilder; | |||
| 25 | use Magento\Framework\Api\ObjectFactory; | 25 | use Magento\Framework\Api\ObjectFactory; | |||
| 26 | use Magento\Framework\Api\Search\FilterGroup; | 26 | use Magento\Framework\Api\Search\FilterGroup; | |||
| 27 | use Magento\Framework\Api\Search\FilterGroupBuilder as SourceFilterGroupBuilder; | 27 | use Magento\Framework\Api\Search\FilterGroupBuilder as SourceFilterGroupBuilder; | |||
| 28 | use Magento\Framework\App\RequestInterface; | 28 | use Magento\Framework\App\RequestInterface; | |||
| 29 | use Magento\Store\Model\StoreManagerInterface; | 29 | use Magento\Store\Model\StoreManagerInterface; | |||
| 30 | 30 | |||||
| 31 | /** | 31 | /** | |||
| 32 | * Builder for FilterGroup Data. | 32 | * Builder for FilterGroup Data. | |||
| 33 | */ | 33 | */ | |||
| 34 | class FilterGroupBuilder extends SourceFilterGroupBuilder | 34 | class FilterGroupBuilder extends SourceFilterGroupBuilder | |||
| 35 | { | 35 | { | |||
| 36 | /** @var RequestInterface */ | 36 | /** @var RequestInterface */ | |||
| 37 | protected $_request; | 37 | protected $_request; | |||
| 38 | /** | 38 | /** | |||
| 39 | * @var StoreManagerInterface | 39 | * @var StoreManagerInterface | |||
| 40 | */ | 40 | */ | |||
| 41 | protected $storeManager; | 41 | protected $storeManager; | |||
| 42 | 42 | |||||
| 43 | /** | 43 | /** | |||
| 44 | * FilterGroupBuilder constructor. | 44 | * FilterGroupBuilder constructor. | |||
| 45 | * | 45 | * | |||
| 46 | * @param ObjectFactory $objectFactory | 46 | * @param ObjectFactory $objectFactory | |||
| 47 | * @param FilterBuilder $filterBuilder | 47 | * @param FilterBuilder $filterBuilder | |||
| 48 | * @param RequestInterface $request | 48 | * @param RequestInterface $request | |||
| 49 | * @param StoreManagerInterface $storeManager | 49 | * @param StoreManagerInterface $storeManager | |||
| 50 | */ | 50 | */ | |||
| 51 | public function __construct( | 51 | public function __construct( | |||
| 52 | ObjectFactory $objectFactory, | 52 | ObjectFactory $objectFactory, | |||
| 53 | FilterBuilder $filterBuilder, | 53 | FilterBuilder $filterBuilder, | |||
| 54 | RequestInterface $request, | 54 | RequestInterface $request, | |||
| 55 | StoreManagerInterface $storeManager | 55 | StoreManagerInterface $storeManager | |||
| 56 | ) { | 56 | ) { | |||
| 57 | $this->_request = $request; | 57 | $this->_request = $request; | |||
| 58 | $this->storeManager = $storeManager; | 58 | $this->storeManager = $storeManager; | |||
| 59 | 59 | |||||
| 60 | parent::__construct($objectFactory, $filterBuilder); | 60 | parent::__construct($objectFactory, $filterBuilder); | |||
| 61 | } | 61 | } | |||
| 62 | 62 | |||||
| 63 | /** | 63 | /** | |||
| 64 | * @return FilterGroupBuilder | 64 | * @return FilterGroupBuilder | |||
| 65 | */ | 65 | */ | |||
| 66 | public function cloneObject() | 66 | public function cloneObject() | |||
| 67 | { | 67 | { | |||
| 68 | $cloneObject = clone $this; | 68 | $cloneObject = clone $this; | |||
| 69 | $cloneObject->setFilterBuilder(clone $this->_filterBuilder); | 69 | $cloneObject->setFilterBuilder(clone $this->_filterBuilder); | |||
| 70 | 70 | |||||
| 71 | return $cloneObject; | 71 | return $cloneObject; | |||
| 72 | } | 72 | } | |||
| 73 | 73 | |||||
| 74 | /** | 74 | /** | |||
| 75 | * @param $filterBuilder | 75 | * @param $filterBuilder | |||
| 76 | */ | 76 | */ | |||
| 77 | public function setFilterBuilder($filterBuilder) | 77 | public function setFilterBuilder($filterBuilder) | |||
| 78 | { | 78 | { | |||
| 79 | $this->_filterBuilder = $filterBuilder; | 79 | $this->_filterBuilder = $filterBuilder; | |||
| 80 | } | 80 | } | |||
| 81 | 81 | |||||
| 82 | /** | 82 | /** | |||
| 83 | * @param $attributeCode | 83 | * @param $attributeCode | |||
| 84 | * @return $this | 84 | * @return $this | |||
| 85 | * @throws \Magento\Framework\Exception\NoSuchEntityException | 85 | * @throws \Magento\Framework\Exception\NoSuchEntityException | |||
| 86 | */ | 86 | */ | |||
| 87 | public function removeFilter($attributeCode) | 87 | public function removeFilter($attributeCode) | |||
| 88 | { | 88 | { | |||
| 89 | if (isset($this->data[FilterGroup::FILTERS]) && is_array($this->data[FilterGroup::FILTERS])) { | 89 | if (isset($this->data[FilterGroup::FILTERS]) && is_array($this->data[FilterGroup::FILTERS])) { | |||
| 90 | $count = 0; | 90 | $count = 0; | |||
| 91 | foreach ($this->data[FilterGroup::FILTERS] as $key => $filter) { | 91 | foreach ($this->data[FilterGroup::FILTERS] as $key => $filter) { | |||
| 92 | if ($filter->getField() === $attributeCode) { | 92 | if ($filter->getField() === $attributeCode) { | |||
| 93 | if ($attributeCode === 'category_ids' | 93 | if ($attributeCode === 'category_ids' | |||
| 94 | && (($filter->getValue() === $this->_request->getParam('id') && !$count) | 94 | && (($filter->getValue() === $this->_request->getParam('id') && !$count) | |||
| 95 | || $filter->getValue() === $this->storeManager->getStore()->getRootCategoryId() | 95 | || $filter->getValue() === $this->storeManager->getStore()->getRootCategoryId() | |||
| 96 | ) | 96 | ) | |||
| 97 | ) { | 97 | ) { | |||
| 98 | $count++; | 98 | $count++; | |||
| 99 | continue; | 99 | continue; | |||
| 100 | } | 100 | } | |||
| 101 | unset($this->data[FilterGroup::FILTERS][$key]); | 101 | unset($this->data[FilterGroup::FILTERS][$key]); | |||
| 102 | } | 102 | } | |||
| 103 | } | 103 | } | |||
| 104 | } | 104 | } | |||
| 105 | 105 | |||||
| 106 | return $this; | 106 | return $this; | |||
| 107 | } | 107 | } | |||
| 108 | 108 | |||||
| 109 | /** | 109 | /** | |||
| 110 | * @param $categoryIds | 110 | * @param $categoryIds | |||
| 111 | * | 111 | * | |||
| 112 | * @return $this | 112 | * @return $this | |||
| 113 | */ | 113 | */ | |||
| 114 | public function setCategoryFilter($categoryIds) | 114 | public function setCategoryFilter($categoryIds) | |||
| 115 | { | 115 | { | |||
| 116 | if (isset($this->data[FilterGroup::FILTERS]) && is_array($this->data[FilterGroup::FILTERS])) { | 116 | if (isset($this->data[FilterGroup::FILTERS]) && is_array($this->data[FilterGroup::FILTERS])) { | |||
| 117 | foreach ($this->data[FilterGroup::FILTERS] as $key => $filter) { | 117 | foreach ($this->data[FilterGroup::FILTERS] as $key => $filter) { | |||
| 118 | if ($filter->getField() === 'category_ids') { | 118 | if ($filter->getField() === 'category_ids') { | |||
| 119 | $filter->setValue($categoryIds); | 119 | $filter->setValue($categoryIds); | |||
| 120 | return $this; | 120 | return $this; | |||
| 121 | } | 121 | } | |||
| 122 | } | 122 | } | |||
| 123 | } | 123 | } | |||
| 124 | 124 | |||||
| 125 | return $this; | 125 | return $this; | |||
| 126 | } | 126 | } | |||
| 127 | 127 | |||||
| 128 | /** | 128 | /** | |||
| 129 | * Return the Data type class name | 129 | * Return the Data type class name | |||
| 130 | * | 130 | * | |||
| 131 | * @return string | 131 | * @return string | |||
| 132 | */ | 132 | */ | |||
| 133 | protected function _getDataObjectType() | 133 | protected function _getDataObjectType() | |||
| 134 | { | 134 | { | |||
| 135 | return FilterGroup::class; | 135 | return FilterGroup::class; | |||
| 136 | } | 136 | } | |||
| 137 | } | 137 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.